Skip to content

Conversation

@JairoTM-es
Copy link

@JairoTM-es JairoTM-es commented Dec 31, 2025

Description (required)

Fixes #6588

What changes did you make and why?

This PR improves the reliability of the Check Pull Request Scope GitHub Actions workflow.

  1. Fixed 403 error when posting out-of-scope comments

    • The workflow was failing with HttpError: Resource not accessible by integration (403) when the github-script step attempted to create a comment on a pull request.
    • This happened because the workflow GITHUB_TOKEN did not have sufficient permissions.
    • Updated the workflow permissions to include:
      contents: read
      issues: write
      pull-requests: write
      models: read
      This allows the workflow to create PR comments successfully.
  2. Made the AI-based scope detection more deterministic and consistent

    • The same pull request diff was sometimes classified differently across runs.
    • To reduce variability and make outputs stable:
      • Set temperature: 0
      • Limited output using max-tokens: 10
      • Updated the prompt to clearly define:
        • what counts as related vs unrelated changes
        • several examples for both categories
        • a strict requirement for the model to return exactly "yes" or "no" in lowercase, with no extra text
    • These adjustments help ensure that the condition
      if: steps.analyze.outputs.response == 'yes'
      behaves consistently.

Tests performed (required)

This PR modifies only a GitHub Actions workflow and does not affect the Android application code or UI.

  • Verified locally that the YAML syntax is valid.
  • Relying on CI to execute the updated workflow on this pull request.
  • No device or emulator testing is required for this type of change.

Screenshots (for UI changes only)

Not applicable — this PR does not introduce UI changes.


Note: I have reviewed CONTRIBUTING.md as recommended for first-time contributors.
Also updated README formatting and other minor fixes unrelated to the main change.

- Fixed workflow permissions so github-script can post PR comments (403 error)
- Set temperature to 0 and limited max-tokens to 10 for deterministic yes/no outputs
- Updated the prompt with clear related/unrelated definitions and strict yes/no requirements
- Fixed workflow permissions so github-script can post PR comments (403 error)
- Set temperature to 0 and limited max-tokens to 10 for deterministic yes/no outputs
- Updated the prompt with clear related/unrelated definitions and strict yes/no requirements
@RitikaPahwa4444
Copy link
Collaborator

Thanks @JairoTM-es. Could you please check the latest documentation for the valid list of inputs, getting this warning:
Screenshot_20260102-200733 Chrome

@JairoTM-es
Copy link
Author

@RitikaPahwa4444 Thanks for the heads-up! I checked the latest actions/ai-inference@v1 documentation and removed the unsupported temperature input.
The workflow now uses only valid inputs (model, max-tokens, and prompt), so the warning should be resolved.


permissions:
contents: read
issues: write
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need write access for issues?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. The issues: write permission is needed because the workflow posts a comment on the pull request when it detects unrelated changes. Without this permission, the comment step fails with a 403 error and the bot cannot provide guidance to the contributor.

If you prefer to keep permissions more restricted, I can remove the auto-comment step and leave the workflow as a check-only validation.

@RitikaPahwa4444
Copy link
Collaborator

Thanks @JairoTM-es! Would you mind pushing some irrelevant commit to a different file? The workflow should hopefully be able to catch and flag it. We can revert after the testing.

@github-actions
Copy link

✅ Generated APK variants!

@RitikaPahwa4444
Copy link
Collaborator

It couldn't detect the unrelated changes, we might have to experiment a bit with the models too. @JairoTM-es would you like to do that? I can change it for the repo as and when you change it here and we can see if it improves. Or I can raise a PR with these changes but change the models, share the findings and then you can update here and we can merge this PR.

Let us know what works better for you.

@JairoTM-es
Copy link
Author

@RitikaPahwa4444 I tested this and the main limitation seems to be the input rather than the model. Since we only pass the PR title and description, unrelated file changes can’t be detected unless they’re mentioned explicitly.

I think it’s best to keep this PR focused and handle model or prompt expansion (e.g. passing changed files or diff summaries) in a follow-up. I’m happy to open an issue for that, or we can iterate in a separate PR if you prefer.

@RitikaPahwa4444
Copy link
Collaborator

@JairoTM-es feel free to raise a follow-up PR and we can test there and merge in reverse order. Sorry, I should have probably kept the scope a bit more open-ended. I'm not sure if these changes improve the status quo and would like to test before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

check_scope workflow is not reliable enough

2 participants